package com.myalias.adapters;

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.widget.Toast;


public class BAdapter implements IAdapter {
	
	// Define constants
	public static final int REQUEST_ENABLE_BT = 3;
	//
	
	protected BluetoothAdapter MyAdapter;
	protected Activity Context;
	
	public BAdapter(Activity context ){
		this.Context = context;
	}
	
	public boolean Initialize(){
		
		if (this.MyAdapter==null){
			this.MyAdapter = BluetoothAdapter.getDefaultAdapter();
		}
		
		
		if (this.MyAdapter==null){
	            Toast.makeText(this.Context, "Bluetooth is not available", Toast.LENGTH_LONG).show();
	            
	            return false;
		}
		
		boolean isEnabled = this.MyAdapter.isEnabled();
		if (isEnabled == false ) {
	        Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
	        this.Context.startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
		}
		
		
		return true;
	}

	public void StartListening() {
		// TODO Auto-generated method stub
		
	}
}
